import { GlobalCanvasStyleType } from "@/store/module/global/type";

export function getStyle() {}
export function getComponentRotatedStyle() {}
export function getShapeStyle(style: any) {
  const result: any = {};
  ["width", "height", "top", "left", "rotate"].forEach((attr) => {
    if (attr != "rotate") {
      result[attr] = style[attr] + "px";
    } else {
      result.transform = "rotate(" + style[attr] + "deg)";
    }
  });
}
export function getSVGStyle(style: any) {}

const filterKeys = ["width", "height", "scale"];
export function getCanvasStyle(canvasStyleData: GlobalCanvasStyleType) {
  const result: GlobalCanvasStyleType = {};
  Object.keys(canvasStyleData)
    .filter((key) => !filterKeys.includes(key))
    .forEach((key) => {
      // @ts-ignore
      result[key] = canvasStyleData[key];
      if (key === "fontSize") {
        // @ts-ignore
        result[key] += "px";
      }
    });

  return result;
}
